<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>从键盘录入</title>
</head>
<body>

    <input type="text" id="user_name"  name="username" placeholder="请输入您的姓名">
    <input type="text" id="age" name="age" placeholder="请输入您的年龄">
    <button onclick="getInput()">提交</button>
</body>
<script>
    function getInput(){
        var username = document.getElementById("user_name").value
        console.log(username)
        console.log(typeof(username))

        var age = Number(document.getElementById("age").value)
        console.log(age)
        console.log(typeof(age))
    }



    // var userName  = prompt("请输入您的姓名:")
    // console.log(userName)
    // console.log(typeof(userName))
    //
    // var age = Number(prompt("请输入您的年龄:"))
    // console.log(age)
    // console.log(typeof(age))
    // age ++
    // console.log(age)
</script>
</html>